package com.ruoyi;

import com.ruoyi.web.core.service.FtpLogMonitor;
import com.ruoyi.web.core.service.SpnUdpReceiver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

/**
 * 启动程序
 * 
 * @author ruoyi
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication implements CommandLineRunner {
    @Autowired
    private SpnUdpReceiver spnUdpReceiver;

    @Autowired
    private FtpLogMonitor ftpLogMonitor;

    public static void main(String[] args) {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(RuoYiApplication.class, args);
        System.out.println("#### NET启动成功 ####");
    }

    @Override
    public void run(String... args) throws Exception {
        // 启动接收程序
        Thread receiverThread = new Thread(spnUdpReceiver::startReceiver);
        receiverThread.start();

        // 启动ftp日志监控
        Thread ftpLogThread = new Thread(ftpLogMonitor::startMonitor);
        ftpLogThread.start();
    }
}